<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%String path = request.getContextPath();%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>线下还款申请资金明细 管理</title>
    <jsp:include page="../../import.jsp" flush="true"/>
</head>
<body class="iframeBody">
<div class="wrapper">
    <%--    <div class="insOfflineFundDtlForm">--%>
    <%--        <form id="insOfflineFundDtl_form">--%>
    <%--            <div class="fieldset1 tabel_col tabel_col_1 clearFix">--%>
    <%--                <div class="fieldBox col_100">--%>
    <%--                    <div class="label">线下还款申请记录ID</div>--%>
    <%--                    <div class="field">--%>
    <%--                        <input name="applyLogId" id="applyLogId" type="text" class="ui-textbox"--%>
    <%--                               value="${insOfflineRepayLogVO.id}" validate="{required:true,number:true}">--%>
    <%--                        <span class="requiredSymbol">*</span>--%>
    <%--                    </div>--%>
    <%--                </div>--%>
    <%--                <div class="fieldBox col_100">--%>
    <%--                    <div class="label">贷款合同号</div>--%>
    <%--                    <div class="field">--%>
    <%--                        <input name="crCntNo" id="crCntNo" type="text" class="ui-textbox"--%>
    <%--                               value="${insOfflineRepayLogVO.crCntNo}" validate="{required:true,number:true}">--%>
    <%--                    </div>--%>
    <%--                </div>--%>
    <%--                <div class="fieldBox col_100">--%>
    <%--                    <div class="label">还款金额</div>--%>
    <%--                    <div class="field">--%>
    <%--                        <input name="repayAmt" id="repayAmt" type="text" class="ui-textbox"--%>
    <%--                               value="${insOfflineRepayLogVO.repayAmt}"--%>
    <%--                               validate="{required:true,number:true}">--%>
    <%--                        &lt;%&ndash;                        <span class="requiredSymbol">*</span>&ndash;%&gt;--%>
    <%--                    </div>--%>
    <%--                </div>--%>
    <%--                <div class="fieldBox col_100">--%>
    <%--                    <div class="label">申请还款状态</div>--%>
    <%--                    <div class="field">--%>
    <%--                        <select name="fundCd" id="fundCd" data-value="${insOfflineRepayLogVO.applyStsCd}"--%>
    <%--                                validate="{required:true,select:true}">--%>
    <%--                            <option value=" ">--请选择--</option>--%>
    <%--                            <c:forEach items="${applyStsCdList}" var="item">--%>
    <%--                                <option value="${item.code }">${item.codeNm }</option>--%>
    <%--                            </c:forEach>--%>
    <%--                        </select>--%>
    <%--                    </div>--%>
    <%--                </div>--%>
    <%--            </div>--%>
    <%--            &lt;%&ndash;            <div class="btnsBox">&ndash;%&gt;--%>
    <%--            &lt;%&ndash;                <span id="saveInsOfflineFundDtl_Btn" class="sq-button sq-button-hasicon l-dialog-btn-ok">&ndash;%&gt;--%>
    <%--            &lt;%&ndash;                <i class="sqBtnIco_10"></i>保存</span>&ndash;%&gt;--%>
    <%--            &lt;%&ndash;                <input type="reset" id="resetBtn" class="l-button l-button-reset Hide">&ndash;%&gt;--%>
    <%--            &lt;%&ndash;            </div>&ndash;%&gt;--%>
    <%--        </form>--%>
    <%--    </div>--%>
    <div id="ligergrid" class="sq-grid"></div>

    <div class="btnsBox" style="text-align: center;">
        <span id="saveCapPayInfoBtn" class="sq-button sq-button-round">保存</span>
    </div>
</div>
<script>
    var grid = null, menu = null;
    $(function() {
        grid = $("#ligergrid").ligerGrid({
			url: '<%=path%>/capital/capFund/queryByCustomerId.do',
			parms:{cstId:180920030003288},
			method: 'get',
			columns: [
				{display: '资金编号', name: 'code', width: 130, align: 'left', enabledSort: false,
					render:function(rowdata,index,value){
						return '<a href="javascript:;" style="cursor: pointer;" onclick="qyFund('+rowdata.id+')">'+rowdata.code+'</a>';
					}
				},
				{display: '收款名称', name: 'acceptName', minWidth: 100, align: 'left', enabledSort: false},
				{display: '收款账号', name: 'acceptCode', minWidth: 80, align: 'left', enabledSort: false},
				{display: '交易(到账)日期', name: 'acceptDate', width: 100, align: 'center', enabledSort: false,render:renderDate},
				{display: '客户名称', name: 'cstNm', width: 90, align: 'left', enabledSort: false,},
				{display: '来款账号', name: 'comeCode', minWidth: 80, align: 'left', enabledSort: false},
				{display: '来款户名', name: 'comeName', width: 100, align: 'left', enabledSort: false},
				{display: '来款金额', name: 'amount', width: 90, align: 'right', enabledSort: false,
					render:function(rowdata,index,value){
						return '&yen;'+FormatMoney(rowdata.amount/100);
					}
				},
				{display: '可用金额', name: 'availableAmount', width: 90, align: 'right', enabledSort: false,
					render:function(rowdata,index,value){
						return '&yen;'+FormatMoney(rowdata.availableAmount/100);
					}
				},
			],
			usePager: false,
			root: 'rows',
			record: 'total',
			hideLoadButton: true,
			width: '100%',
			height: '100%',
			heightDiff: -2,
			checkbox: true,
			rownumbers: true,
			allowUnSelectRow: true,
			alternatingRow: true
		});
		grid.setHeight(300);

        var insOfflineFundDtlId = "${insOfflineRepayLogVO.id}";//主键ID
        $("#insOfflineFundDtl_form").ligerForm({
            validate: true
        });
        /*保存*/
        $("#saveInsOfflineFundDtl_Btn").click(function (event) {
            var form = liger.get("insOfflineFundDtl_form");
            if (!form.valid()) {
                $.ligerDialog.SQalert({content: LogUtils.LOG_CMM_MUST_FIX_ITEM_INFO, SQ_type: "warning"});
                return false; //验证不通过，不执行以下代码
            }
            var data = form.getData();
            $.ligerDialog.hide();
            var _url;
            if (insOfflineFundDtlId == '') {//新增
                _url = '<%=path%>/repay/insOfflineFundDtl/add.do';
            } else {//修改
                _url = '<%=path%>/repay/insOfflineFundDtl/modify.do?id=' + insOfflineFundDtlId;
            }
            var wait_dialog;
            $.ajax({
                type: 'post',
                dataType: 'json',
                data: data,
                url: _url,
                beforeSend: function () {
                    wait_dialog = $.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING, SQ_type: "waitting"});
                },
                success: function (msg) {
                    wait_dialog.close();
                    if (msg.success == 1) {
                        $.ligerDialog.SQalert({content: msg.info, SQ_type: "success"});
                        parent.$("#clearBtn").click();
                        parent.$("#searchBtn").click();
                        frameElement.dialog.close();

                        //$("#resetBtn").click();
                        //回调刷新列表
                        //var callback=frameElement.W2W.callback;
                        //Remove_navTab();
                        //callback();
                    } else {
                        $.ligerDialog.SQalert({content: msg.info, SQ_type: "error"});
                    }
                }
            });
        });
    });

        //格式化时间
    function renderDate(rowdata, index, value) {
        var dateStr = "";
        if (null != value) {
            var date = new Date(value);
            dateStr = DateUtils.formatDate(date, DateUtils.YYYY_MM_DD);
        }
        return dateStr;
    }
</script>
</body>
</html>